<?php
/**
 * +--------------------------------------------------------+
 * @Created by Phpstorm.
 * @Category StockService.php
 * @Depiction
 * @Author hwy <429208948@qq.com>
 * @Date 2022/4/19  17:51
 * +--------------------------------------------------------+
 */

namespace App\Services;

use App\Repositories\StockRepository;

class StockService extends BaseService
{
    protected $stockRepository;

    public function __construct(StockRepository $stockRepository)
    {
        $this->stockRepository = $stockRepository;
    }

    /**
     * @param $params
     * @return array
     * @Depiction
     * @Author hwy <429208948@qq.com>
     * @Date 2022/4/18  14:17
     */
    public function getList($params)
    {
        $list = $this->stockRepository->getList($params);

        return $this->initPaginateData($list);
    }

    /**
     * @return bool
     * @Depiction
     * @Author hwy <429208948@qq.com>
     * @Date 2022/4/24  16:13
     */
    public function addData()
    {
        $data = [];
        if (class_exists('\App\Util\Stock')) {
            $data = (new \App\Util\Stock())->addDataByEniu();
        }

        $res = $this->stockRepository->addData($data);

        return $res;
    }



}
